package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.ProcessFlow;
import com.indusfo.spc.service.ProcessFlowService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类说明:工艺流程控制器层
 * 
 * @author XIET
 * 
 * @version 创建时间：2018年12月6日 下午3:13:18
 */

@Controller
@RequestMapping("/processFlow")
public class ProcessFlowController {
	
	/**
	 * 注入service
	 */
	@Resource
	private ProcessFlowService processFlowService;
	
	/**
	 * 查询所有工艺流程
	 * @param processFlow
	 * @return
	 */
	@RequestMapping("/queryProcessFlow")
	@SystemControllerLog(description="查询所有工艺流程")
	@ResponseBody
	public JSONObject queryProcessFlow(ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.queryProcessFlow(processFlow);
		return jsonObject;
	}
	
	/**
	 * 删除工艺流程
	 * @param lProFlows
	 * @param lDataState
	 * @return
	 */
	@RequestMapping("/deleteProcessFlow")
	@SystemControllerLog(description="删除工艺流程")
	@ResponseBody
	public JSONObject deleteProcessFlow(@RequestParam("lProFlows") List<Integer> lProFlows, Integer lDataState) {
		JSONObject jsonObject = processFlowService.deleteProcessFlow(lProFlows, lDataState);
		return jsonObject;
	}
	
	
	/**
	 * 新增工艺流程
	 * @param processFlow
	 * @return
	 */
	@RequestMapping("/insertProcessFlow")
	@SystemControllerLog(description="新增工艺流程")
	@ResponseBody
	public JSONObject insertProcessFlow(ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.insertProcessFlow(processFlow);
		return jsonObject;
	}
	
	/**
	 * 修改工艺流程
	 * @param processFlow
	 * @return
	 */
	@RequestMapping("/updateProcessFlow")
	@SystemControllerLog(description="修改工艺流程")
	@ResponseBody
	public JSONObject updateProcessFlow(ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.updateProcessFlow(processFlow);
		return jsonObject;
	}
	

	



	//上移
	@RequestMapping("/orderUp")
	@ResponseBody
	public JSONObject orderUp(ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.orderUp(processFlow);
		return jsonObject;
	}

	//下移
	@RequestMapping("/orderDown")
	@ResponseBody
	public JSONObject orderDown(ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.orderDown(processFlow);
		return jsonObject;
	}


	/**
	 * 新增工艺流程
	 * @param
	 * @return
	 */
	@RequestMapping("/batchInsertProcessFlow")
	@SystemControllerLog(description="新增工艺流程")
	@ResponseBody
	public JSONObject batchInsertProcessFlow(@RequestParam("lProIds") List<Integer> lProIds, Integer lProVer) {
		JSONObject jsonObject = processFlowService.batchInsertProcessFlow(lProIds,lProVer);
		return jsonObject;
	}


	//保存  List<ProcessFlow> processFlowLis
	@RequestMapping("/saveProcessFlow")
	@ResponseBody
	public JSONObject saveProcessFlow(@RequestBody List<ProcessFlow> processFlowList) {
		JSONObject jsonObject = processFlowService.saveProcessFlow(processFlowList);
		return jsonObject;
	}

	//保存  List<ProcessFlow> processFlowLis
	@RequestMapping("/saveProcessTarget")
	@ResponseBody
	public JSONObject saveProcessTarget(@RequestBody ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.saveProcessTarget(processFlow);
		return jsonObject;
	}

	//保存  List<ProcessFlow> processFlowLis
	@RequestMapping("/saveProcessSta")
	@ResponseBody
	public JSONObject saveProcessSta(@RequestBody ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.saveProcessSta(processFlow);
		return jsonObject;
	}

	//保存  List<ProcessFlow> processFlowLis
	@RequestMapping("/saveProcessBom")
	@ResponseBody
	public JSONObject saveProcessBom(@RequestBody  ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.saveProcessBom(processFlow);
		return jsonObject;
	}

	//保存  List<ProcessFlow> processFlowLis
	@RequestMapping("/saveProcessBlxx")
	@ResponseBody
	public JSONObject saveProcessBlxx(@RequestBody  ProcessFlow processFlow) {
		JSONObject jsonObject = processFlowService.saveProcessBlxx(processFlow);
		return jsonObject;
	}





}
